// debugger;
function findNumberIn2DArray(matrix: number[][], target: number): boolean {
    console.log(matrix[0].length);
    if(matrix.length == 0){
        return false;
    }

    for (let x = matrix[0].length - 1; x >= 0; x--) {
        console.log(x);

        if (matrix[0][x] == target) {
            return true;
        }
        if (matrix[0][x] < target) {
            for (let y = 0; y < matrix.length; y++) {
                if (matrix[y][x] == target) {
                    return true;
                }
                if (matrix[y][x] > target) {
                    break;
                }
            }
        }
    }

    return false;
};
console.log(findNumberIn2DArray([[5],[6]],6));
